using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GraphCompiler.Core.SyntaxRepresentation
{
    public class SyntaxNode
    {
        List<SyntaxNode> _children = new List<SyntaxNode>();

        public IEnumerable<SyntaxNode> Children
        {
            get
            {
                return _children.Skip(0);
            }
        }

        public void AddChild(SyntaxNode node)
        {
            _children.Add(node);
        }

        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }

            var other = obj as SyntaxNode;

            if (_children.Count != other._children.Count)
                return false;

            for (int i = 0; i < _children.Count; i++)
            {
                if (!_children[i].Equals(other._children[i]))
                    return false;
            }

            return true;
        }
    }
}
